import {COOKIE_HTTP_ONLY, COOKIE_MAX_AGE, COOKIE_PATH, COOKIE_SAME_SITE} from '~/common/constants'
import {CookieOptions} from '#app'

export const setCookie = (name: string, options: CookieOptions = {
  path: COOKIE_PATH,
  sameSite: COOKIE_SAME_SITE,
  httpOnly: COOKIE_HTTP_ONLY,
  // 过期时间 30天,秒
  maxAge: COOKIE_MAX_AGE
}) => {
  return useCookie(name, options)
}
